package com.coincalf.wallet.blockchain.bean.trx;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

/**
 * 交易广播返回值
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BroadcastResponse {

    /**
     * 交易广播失败返回值：
     * {
     * "result": false,
     * "code": "CONTRACT_VALIDATE_ERROR",
     * "txid": "398b3fedf87ff6521d3333277b8a3f93a2ae35ce4e061d7cabc748101ed71bf1",
     * "message": "contract validate error : Validate TransferContract error, balance is not sufficient.",
     * "transaction": "{\"raw_data\": {\"ref_block_bytes\": \"be7c\",\"ref_block_hash\": \"00497ad31dba0e91\",\"expiration\": 1599071727000,\"contract\": [{\"type\": \"TransferContract\",\"parameter\": {\"type_url\": \"type.googleapis.com/protocol.TransferContract\",\"value\": \"0a1541983e00a976bb9759e5fed5a063d6c91a1fd5bf641215414190e28e2dd0d5922936c2cb9a4b551a615ec0bb1880a3c347\"}}],\"timestamp\": 1599035734956},\"signature\": [\"7e88c9b5b058995cdd11936af8fa26a2a3efbb66d134298d5db706acada9fd6717ce6543905031ee85c97cfd7e22977a33ce43d7a32efc45297751c6d9ae4bf200\"]}"
     * }
     * <p>
     * 交易广播成功返回值：
     * {
     * "result": true,
     * "code": "SUCCESS",
     * "txid": "c93912dccdf9267168ce807fffa7e2c6e21ef513be87c0cc79fabc0a604e6c5d",
     * "message": "",
     * "transaction": "{\"raw_data\": {\"ref_block_bytes\": \"bef2\",\"ref_block_hash\": \"b2bc483bcc9bd928\",\"expiration\": 1599072081000,\"contract\": [{\"type\": \"TransferContract\",\"parameter\": {\"type_url\": \"type.googleapis.com/protocol.TransferContract\",\"value\": \"0a1541983e00a976bb9759e5fed5a063d6c91a1fd5bf641215414190e28e2dd0d5922936c2cb9a4b551a615ec0bb18c096b102\"}}],\"timestamp\": 1599036102896},\"signature\": [\"939e66cb8308c56a5b354ae8d6b788d7a12ab27d137c3a3119794d0c627a01b12390190e23edfccc00e28d6fa910019127cd7f568ba25aced7896c6585fafb4e01\"]}"
     * }
     */

    @JsonProperty("result")
    private Boolean result;
    @JsonProperty("code")
    private String code;
    @JsonProperty("txid")
    private String txId;
    @JsonProperty("message")
    private String message;
    @JsonProperty("transaction")
    private Object transaction;

}
